package com.hq.ims.userpc.controller;

import com.hq.ims.data.annotation.UserOperationMonitor;
import com.hq.ims.data.utils.LocalConstant;
import com.hq.ims.data.vo.BusInfoFeedbackMapstruct;
import com.hq.ims.data.vo.BusInfoTrackMapstruct;
import com.hq.ims.userpc.busservice.BusInfoTrackService;
import com.hq.mybatis.base.page.RequestPage;
import com.hq.mybatis.base.page.ReturnPage;
import com.hq.utils.vo.ReturnVo;
import com.hq.web.annotations.GetJsonValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author cx
 * @date 2024/11/26 11:21:02
 * @description 经营信息跟踪Controller
 */
@Api(tags = "经营信息跟踪")
@RestController
@RequestMapping(LocalConstant.SYS_TYPE_USER_PC_URL_PREFIX + "/busInfoTrack")
public class BusInfoTrackController {

    @Resource
    private BusInfoTrackService busInfoTrackService;

    @ApiOperation(value = "列表查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/pageList", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<ReturnPage<BusInfoTrackMapstruct.BusInfoTrackVo>> pageList(
            @RequestBody RequestPage<BusInfoTrackMapstruct.BusInfoTrackVo> page,
            @RequestBody BusInfoTrackMapstruct.PageSearchVo param) {
        return busInfoTrackService.pageList(page, param);
    }

    @ApiOperation(value = "详情", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getDetail", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<BusInfoTrackMapstruct.DetailVo> getDetail(@GetJsonValue(zh = "跟踪id") String busInfoTrackId) {
        return busInfoTrackService.getDetail(busInfoTrackId);
    }

    @UserOperationMonitor
    @ApiOperation(value = "变更经营人员", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/changePersonnel", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> changePersonnel(@RequestBody @Valid BusInfoTrackMapstruct.ChangePersonnelVo changePersonnelVo) {
        return busInfoTrackService.changePersonnel(changePersonnelVo);
    }

    @UserOperationMonitor
    @ApiOperation(value = "填写反馈", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/fillFeedback", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<Boolean> fillFeedback(@RequestBody @Valid BusInfoFeedbackMapstruct.SaveVo saveVo) {
        return busInfoTrackService.fillFeedback(saveVo);
    }
}
